<template>
  <!-- 搜索 -->
  <div class="m-indexHd">
    <topNavSecher />
    <!-- 导航 -->
    <navListChang />
  </div>
  <!-- 轮播图 -->
  <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
    <van-swipe-item v-for="item in focusList" :key="item.id">
      <a :href="item.originSchemeUrl">
        <img :src="item.picUrl" alt="">
      </a>
    </van-swipe-item>
  </van-swipe>
  <iconHome></iconHome>
  <!-- Grid 宫格 -->
  <van-grid :column-num="5" style="font-size: 14px;">
    <van-grid-item v-for="item in kingKongList" :key="item.text">
      <a :href="item.schemeUrl">
        <van-image class="image" :src="item.picUrl" />
        <div class="txt" style="color:#333 ;">{{ item.text }}</div>
      </a>
    </van-grid-item>

  </van-grid>
</template>

<script setup lang="ts">
import topNavSecher from '../topNavSecher/index.vue'
import navListChang from '../navListChang/index.vue'
import iconHome from "../iconHome/index.vue"


import { ref } from 'vue'
import { getBannerListTwo } from '../../api/home'
import { onMounted } from 'vue'
let timestamp = ref(Date.now())
const focusList = ref<any[]>([])
const kingKongList = ref<any[]>([])
onMounted(() => {
  getBannerListTwoss()
})
const getBannerListTwoss = async () => {
  try {
    let res = await getBannerListTwo(timestamp.value)
    focusList.value = res.data.data.focusList
    kingKongList.value = res.data.data.kingKongModule.kingKongList

  } catch (error) {
    console.log(error);
  }
}
</script>

<style scoped lang="less">
.banners_conter {
  width: 100%;

  .m-indexHd {


    .line {


      .m-topSearchIpt {
        display: flex;
        flex-flow: row nowrap;
        align-items: center;
        width: 221px;
        height: 28px;
        justify-content: center;
        font-size: 12px;
        background-color: #ededed;



      }


    }

    // 导航
    .tabWrap {
      width: 375px;
      position: relative;
      z-index: 2;
      background: #fff;
      margin-top: -7.5px;



      .tm-tabs {
        width: 100%;
        height: 100%;

        header {
          display: flex;
          -webkit-box-direction: normal;
          -webkit-box-orient: horizontal;
          flex-flow: row nowrap;
          background-color: #fff;
          position: relative;


          .tab.active {
            color: #dd1a21;

            .txt {
              position: relative;
              color: #dd1a21;

            }


          }

          .tab {
            display: flex;
            -webkit-box-direction: normal;
            -webkit-box-orient: horizontal;
            flex-flow: row nowrap;
            -webkit-box-align: center;
            align-items: center;
            justify-content: center;
            position: relative;
            z-index: 1;
            text-align: center;
            margin-right: 10px;

            .txt {
              display: inline-block;
              padding: 0px 8px;
              line-height: 30px;
              font-size: 14px;
              text-align: center;
              color: #333;
            }

          }
        }

      }

      // 下拉样式
      .toggleWrap {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 0;
        right: 0;

        .linear {
          width: 30px;
          width: 30px;
          background-image: linear-gradient(90deg, hsla(0, 0%, 100%, 0) 0, #fff)
        }

        .toggle {
          width: 50px;
          height: 30px;
          text-align: center;
          background: #fff;

          .icon {
            margin-top: 7.5px;
            background-image: url('	https://yanxuan-static.nosdn.127.net/hxm/yanxuan-mall-wap/assets/img/arrow-dc528da35c384481e18b0291eaf8d6e7.png');
            display: inline-block;
            vertical-align: middle;
            width: 15px;
            height: 15px;
            background-size: 53px 42.5px;
            background-position: 17px 0;
            transition: transform .5s, -webkit-transform .5s;
          }



        }
      }
    }
  }

  // 点击下拉，全部导航的样式
  .m-indexHd .tabWrap .moreCate {
    padding-top: 12px;
    overflow: hidden;
    font-size: 12px;
  }

  .m-indexHd .tabWrap .moreCate .cateTag {
    width: 75px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    float: left;
    margin-bottom: 20px;
    margin-left: 15px;
    background: #fafafa;
    border-radius: 2px;
    border: 1px solid #ccc
  }

  .m-indexHd .tabWrap .moreCate .cateTag-active {
    border: 1px solid #dd1a21;
    color: #dd1a21;
  }

  // 轮播图样式
  .my-swipe {
    width: 375px;

    img {
      width: 100%;
    }

    .my-swipe .van-swipe-item {
      color: #fff;
      font-size: 20px;
      line-height: 150px;
      text-align: center;
      width: 375px;
      height: 185px;
      background-color: #39a9ed;
    }

  }

  // icon+text
  .container {
    background: #fff;

    .g-grow {
      width: 100%;
      box-sizing: border-box;
      height: 36px;
      padding: 0 15px;
      display: flex;
      flex-flow: row nowrap;
      align-items: center;
      zoom: 1;
    }

    .item {
      flex: 1;
      float: left;

      .special-icon {
        background-size: 100% 100%;
        background-position: 50%;
      }

      .u-icon-index-servicePolicy {
        width: 16px;
        height: 16px;
        display: inline-block;
        vertical-align: middle;
      }
    }

    .text {
      font-size: 12px;
      color: #333;
      margin-left: 4px;
      line-height: 16px;
      display: inline-block;
      vertical-align: middle;
      zoom: 1;
    }

  }

  // 宫格
  .image {
    width: 55px;
    height: 55px;
  }

  .txt {
    margin-top: 5px;
    font-size: 12px;
    text-align: center;
    line-height: 18px;
    white-space: nowrap;
  }



  ::v-deep(.van-grid-item__content) {
    font-size: 12px;
  }
}

.my-swipe {
  .van-swipe-item {
    a {
      img {
        width: 375px;
      }
    }
  }

}
</style>